from django.db import models
from userapp.models import User
from cartapp.models import Cart
from goodsapp.models import Goods
# Create your models here.


class Order(models.Model):
    uuid = models.ImageField(verbose_name='订单号')
    sum = models.FloatField(verbose_name='总价')
    status = models.CharField(max_length=10,default='未支付',verbose_name='状态')
    user = models.ForeignKey(User, on_delete=models.CASCADE)

class OrderItem(models.Model):
    order_img = models.ImageField(upload_to='static/img')
    order_name = models.CharField(max_length=30,verbose_name='名称')
    order_price = models.FloatField(verbose_name='价格')
    order_count = models.IntegerField(verbose_name='数量')
    Order = models.ForeignKey(Order, on_delete=models.CASCADE)
    goods = models.ForeignKey(Goods, on_delete=models.CASCADE)